//
//  ViewController.m
//  CATransition转场动画
//
//  Created by hyl on 16/7/5.
//  Copyright © 2016年 hyl. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *imageView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
static int i=2;
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{

    if (i>3) {
        i=2;
    }
    NSString *imageName=[NSString stringWithFormat:@"%d",i];
    self.imageView.image=[UIImage imageNamed:imageName];
    
    CATransition *transaction=[CATransition animation];
    transaction.type=@"pageCurl";
    [self.imageView.layer addAnimation:transaction forKey:nil];
    i++;
}
@end
